<template>
	<view class='box4'>
		<mask v-if="showMaskon" :class='showMask'></mask>
		<view v-for="range in rangess">
			{{range}}
		</view>
		<view v-for="range in rangess">
			{{range}}
		</view>
		<view v-for="range in rangess">
			{{range}}
		</view>
		<view v-for="range in rangess">
			{{range}}
		</view>
		<view v-for="range in rangess">
			{{range}}
		</view>
		<button type="primary" @click="turnToindex">退回主页</button>
		<view v-for="range in rangess">
			{{range}}
		</view>
		
	</view>

</template>

<script>
	export default {
		onLoad(canshu) {
			console.log(canshu)
		},
		// onload用来接受上个页面传递的参数,canshu是形参
		data() {
			return {
				u:0,
				rangess:['a','b','c','d'],
				showMask:'cpt-mask',
				showMaskon:false
			}
		},
		onPullDownRefresh() {
			this.u=++this.u
			setTimeout(()=>{
				console.log(this.u)
			},1000)
			if(this.u>5){
				console.log("nope")
			}
			uni.stopPullDownRefresh()	
		},
		onReachBottom() {
			console.log('页面触底')
		
			this.rangess = [...this.rangess,...['JAVA','UI','前端','测试']]
			// debugger
		},
		onBackPress() {
		  if(this.showMaskon) {  
		    this.showMaskon = false;  
		    return true;  
		  }  
		},
		methods: {
				turnToindex(){
					uni.switchTab({
						url:'../index/index',
						success() {
							console.log('跳转完成')
						}
					})
				}
			}
	}
</script>

<style>
	.box4{
		height: 200px;
		line-height: 400px;
	}
	.cpt-mask {
	        position: fixed;  
	        top: 0;  
	        left: 0;  
	        width: 100%;  
	        height: 100%;  
	        background-color: #000000;  
	        opacity: 0.5;  
	        z-index: 99;  
	    } 
</style>
